Skip to content

Refactoring 3 - #22

Merged
androidmage merged 3 commits into
androidmage:masterfrom
jherd23:master
Jan 8, 2016
Merged

Refactoring 3#22
androidmage merged 3 commits into
androidmage:masterfrom
jherd23:master

Conversation

@jherd23

@jherd23 jherd23 commented Jan 8, 2016

Copy link
Copy Markdown
Contributor

+$DIRECTIONS: array containing all usable directions (not NONE,OMNI)
*intToDir(): refactored. Now just looks up the proper element in $DIRECTIONS, not rotating i times, so time is O(1), not O(n).
*dirToInt(): refactored. Now loops through $DIRECTIONS and sees if @d matches any of them, then returns that index, or 0 for NONE/OMNI
*Guard/Soldier AI: use the Direction class's @opposite method, rather than extra method
-RESOURCE_FUNCTIONS.getOpposite: removed, as Direction.opposite() is better for this use

+$DIRECTIONS: array containing all usable directions (not NONE,OMNI)
*intToDir(): refactored. Now just looks up the proper element in $DIRECTIONS, not rotating i times, so time is O(1), not O(n).
*dirToInt(): refactored. Now loops through $DIRECTIONS and sees if @d matches any of them, then returns that index, or 0 for NONE/OMNI
*Guard/Soldier AI: use the Direction class's @opposite method, rather than extra method
-RESOURCE_FUNCTIONS.getOpposite: removed, as Direction.opposite() is better for this use
androidmage added a commit that referenced this pull request Jan 8, 2016
@androidmage
androidmage merged commit ded0cdf into androidmage:master Jan 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants